package qhLoading 
{
	/**
	 * ...
	 * @author gcxk721
	 */
	public class QhLoadItem 
	{
		
		public var name : String;
        public var path : String;
        public var type : String;
		public var version : String;
		
		public function QhLoadItem() 
		{
			
		}
		
		/**
		 * 取得一个加载对象
		 * @param	_name
		 * @param	_path
		 * @param	_type
		 * @param	_version
		 * @return
		 */
		public static function getLoadItem(_name : String, _path : String, _version : String = "") : QhLoadItem
		{
			var item : QhLoadItem = new QhLoadItem();
			item.name = _name;
			item.type = getFileType(_path);
			if (_version != "")
			{
				item.path = _path + "?v=" + _version;
			}
			else
			{
				item.path = _path;
			}
			item.version = _version;
			return item;
		}
		
		/**
		 * 取得文件后缀名
		 * @return
		 */
		private static function getFileType(_path : String) : String
		{
			var index : int = _path.lastIndexOf(".");
			if (index != -1)
			{
				return _path.substring(index + 1, _path.length).toLocaleUpperCase();
			}
			return null;
		}
		
	}

}